﻿#ifndef MEDIATOOLS_H
#define MEDIATOOLS_H

#include "YToolWidget.h"
// add by liq 15
#include "HookThread.h"

namespace Ui {
class MediaTools;
}

enum MediaType{
    AVI, GIF
};
class YMedia;
class FpsTimer;
class MediaTools : public YToolWidget
{
    Q_OBJECT

public:
    explicit MediaTools(const QString& lastSavePath, QWidget *parent = nullptr);
    ~MediaTools() override;

    void tack(const QRect& rect, const QRect& originScreenRect);

    // add by liq 15
    int x,y;
    bool isMouseLeftButtonPressed = false;
    bool isMouseRightButtonPressed = false;
    HookThread *m_hookThread;

protected:
    void timeout() override;
    void start();
    void save();
    void stop();

private:
    Ui::MediaTools *ui;
    QRect recordArea;
    QWidgetList lines;
    bool isStarted = false;
    bool selected = false;
    MediaType type;

    FpsTimer* timer = nullptr;
    YMedia* media = nullptr;

    int count;

// add by liq 15
public slots:
    void on_mouseEvent(QMouseEvent* event);
};

#endif // MEDIATOOLS_H
